<!-- 会员管理的组件 -->
<template>
<div>
  <el-table :data="users.filter(data => !search || data.username.toLowerCase().includes(search.toLowerCase()))" style="width: 100%">
    <el-table-column label="id" prop="id">
    </el-table-column>
    <el-table-column label="Name" prop="username">
    </el-table-column>
    <el-table-column label="权限" prop="is_admin">
    </el-table-column>
    <el-table-column align="right">
      <template slot="header" slot-scope="scope">
        <el-input v-model="search" size="mini" placeholder="输入关键字搜索" />
      </template>
      <template slot-scope="scope">
        <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
      </template>
    </el-table-column>
  </el-table>
</div>
</template>

<script>
export default {
  data () {
    return {
      tableData: [],
      users: [],
      search: ''
    }
  },
  created () {
    this.gethoutaiuser()
  },
  methods: {
    async gethoutaiuser () {
      try {
        //! !!URL一定要吧反单引号包起来
        const res = await this.$axios.post('http://47.106.237.228:10003/api/houtai/yonghu')
        // console.log(this.page);
        // console.log(res)
        const users = res.data.data
        this.users = users
        // console.log(users)
      } catch (error) {
        console.log(error)
      }
    },
    handleDelete (index, row) {
      console.log(index, row)
      this.$message({
        message: '无法删除',
        type: 'error'
      })
    }

  }
}
</script>

<style lang="less">

</style>
